<include file="public:header" />
<div class="allpagetop">标签管理<strong>/</strong>修改</div>
<div class="admin_main_nr_dbox">
 	    <div class="pagetit">
	        <div class="ptit">标签</div>
				<div class="topnav">
			         
					  <a href="{:RU('tag/lists')}" <if condition="ACTION_NAME eq 'lists'">class="select"</if>>列表</a>
					   <a href="{:RU('tag/add')}" <if condition="ACTION_NAME eq 'add'">class="select"</if>>添加</a>
					   
					     <a href="{:RU('tag/cat')}" <if condition="ACTION_NAME eq 'cat'">class="select"</if>>分类</a>
				    <div class="clear"></div>
				</div>
	        <div class="clear"></div>
	    </div>
		
		
		
    <div class="toptit">添加</div>
  <form action="{:RU('tag/edit')}" method="post"   name="FormData" id="FormData" >
   <input name="id" type="hidden"  id="id" value="{$show.id|default='0'}" />
	  <div class="admin_form_main">
	  
	    <div class="fl">标签名称:</div>
		<div class="fr"><input name="tag" type="text"  class="input_text_default" maxlength="10" placeholder="请输入标签名称" value="{$show.tag}"/></div>
		<div class="fl">标签描述:</div>
		<div class="fr">
		<input name="describe" type="text"  class="input_text_default" maxlength="200" placeholder="请输入标签描述"  value="{$show.describe}"/>
		</div>
		
		<div class="fl">标签排序:</div>
		<div class="fr">
			<input name="sort" type="text"  class="input_text_default" id="sort" maxlength="8" onkeyup="if(event.keyCode !=37 && event.keyCode != 39) value=value.replace(/\D/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))"   placeholder="数字越大越靠前，默认是0" value="{$show.sort}"/>
		</div>
		<notempty name="cat">
		<div class="fl">所属分类:</div>
			<div class="fr">
			<input name="cat" type="hidden"  id="cat" value="{$show.cat|default='0'}" />
			<input name="cat_cn" id="cat_cn" type="text"  class="input_text_default J_cat_show" maxlength="60" placeholder="请选择所属分类" readonly="readonly" value="{$show.cat_cn|default='未分类'}"/>
			</div>
		</notempty>
			
		<div class="fl">上传图标:</div>
		 <div class="fr" id="up_img_show">
		 <input name="img" type="hidden" value="{$show.img}" />
		 
	 		  <if condition="$show.img neq ''">
		 
						 <div class="input_up_img">
								<a href="{$show.imgsrc}" target="_blank">
								<img src="{$show.imgsrc}" border="0" />
								</a>
								<div class="del" id="J_del">删除</div>
						</div>
						
						<div class="input_up_btn" id="input_up_btn" name="tag_img" title="上传图片" style="display:none"></div>
			 			<div class="clear"></div>
						
		 <else />
		 
					<div class="input_up_btn" id="input_up_btn" name="tag_img" title="上传图片"></div>
			 		<div class="clear"></div>
			 
			 </if>
			   
		   		 
				
		</div>
		
		
		<div class="fl">审核通过:</div>
					  <div class="fr">
					  
					   <div class="imgchecked <if condition="$show.audit eq 1 "> select</if>"><input name="audit" type="hidden" value="{$show.audit}" /></div>
					  </div>
		 
		 <div class="fl"></div>
		<div class="fr">
		<input name="" type="submit" class="admin_submit big"    value="保存"/>
		<input name=""  type="button" class="admin_submit big"    value="返回" onclick="history.go(-1)"/>
		</div>
		
		
		
		<div class="clear"></div>
		
	  </div>
  
  
 
  
  
    <div id="J_cat_from"></div>
  </form>
</div>

<div id="J_cat_select" style="display:none">

	  <div class="showdialog">
		<div class="dtit">请选择分类</div>
		  <volist name="cat" id="catlist">
		<div class="dlistx" id="{$catlist.id}">{$catlist.title}</div>
		 </volist>
		<div class="clear"></div>
	  </div>
	  
</div>

<include file="public:footer" />
 <script type="text/javascript">
	var uploadUrl = "__ROOT__/index.php?m=home&c=Upload&a=img";
</script>
<script src="__ROOT__/{:C('UU_ADMINTPL_DIR')}/public/js/ajaxfileupload.js"></script>
<script src="__ROOT__/{:C('UU_ADMINTPL_DIR')}/public/js/fileupload.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
 $(".J_cat_show").dialog({
  DialogAddObj:"#J_cat_from",
  DialogTitle:"请选择所属分类",
  DialogContent:"#J_cat_select",
  DialogContentType:"id"
  });
    
$('#J_cat_from .dlistx').live('click',function() {
  $("#cat_cn").val($(this).html());
  $("#cat").val($(this).attr('id'));
  $(" .FloatBg").remove();
  $(" .FloatBox").remove();
});
	// 上传图标
$.upload('#input_up_btn',{type:'tag_img'},function(result){
		html="";
		html+="<div class=\"input_up_img\">";
		html+="<a href=\"__ROOT__/{:C('UU_IMG_CATEGORY_DIR')}\" target=\"_blank\"><img src=\"__ROOT__/{:C('UU_IMG_CATEGORY_DIR')}\" border=\"0\" /></a>";
		html+="<div class=\"del\" id=\"J_del\">删除</div>";
		html+="</div>";
		
		if(result.status == 1){
			//disapperTooltip("success", "图片上传成功!");
			$("#up_img_show").prepend(html);
			$(".input_up_img").find('a').attr('href',result.content.src);
			$(".input_up_img").find('img').attr('src',result.content.src);
			$(".input_up_btn").hide();			
			$("input[name=img]").val(result.content.savename);
		 
		} else {
			disapperTooltip("remind", "上传失败："+result.content);
		 
		}
	});
	//删除上传图片
	$('#J_del').live('click',function() {
	 	$(".input_up_btn").show();
		$(".input_up_img").hide();
		$("input[name=img]").val('');
	});

});
</script>
</body>
</html>